﻿@using PagedList.Mvc

@model Wlog.Web.Models.LogListModel



@{
    Layout = "~/Views/Shared/_LayoutInternal.cshtml";
}



    <div class="row">
        <h1>Log Messages</h1>
        @using (Html.BeginForm("Logs", "Private", FormMethod.Get))
        {

          
            <p>
                Application: 
                  @Html.DropDownListFor(m=>m.ApplicationId, new SelectList(Model.Apps, 
                               "IdApplication", "ApplicationName", 
                               Model.ApplicationId==0 ? null: Model.ApplicationId))
                Find Message: @Html.TextBox("SerchMessage", Model.SerchMessage)
                <input type="submit" value="Search" class="btn btn-default" />
            </p>
        }
    </div>
    <div class="row">
        <table class="table table-striped table-hover ">
            <thead>
                <tr>
                    <th>
                        @Html.ActionLink("Date", "Logs", new {ApplicationId=Model.ApplicationId, sortOrder = "Date", Model.SerchMessage })
                    </th>
                    <th>
                        @Html.ActionLink("Level", "Logs", new {ApplicationId=Model.ApplicationId, sortOrder ="Level", Model.SerchMessage })
                    </th>
                    <th>Message
                    </th>
                </tr>
                @foreach(var item in Model.Items)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(x => item.SourceDate)
                        </td>
                        <td>
                            @Html.DisplayFor(x=>item.Level)
                        </td>
                        <td>
                            @Html.DisplayFor(x=>item.Message)
                        </td>
                    </tr>
                }
            </thead>
            <tbody></tbody>
        </table>
        <br />
        Page @(Model.Items.PageCount < Model.Items.PageNumber ? 0 : Model.Items.PageNumber) of @Model.Items.PageCount

       @Html.PagedListPager(Model.Items, page => Url.Action("Logs",
    new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))

    </div>

